package com.swpu.demo.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
@Component
public class LoginInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request,
                             HttpServletResponse response,
                             Object handler) throws Exception {
        if (request.getSession().getAttribute("sysUser") == null) {
            //跳转到后台登录页面
            response.sendRedirect("");
            return false;
        }
        if (request.getSession().getAttribute("personalData") == null) {
            //跳转到前台登录页面
            response.sendRedirect("");
            return false;
        }
        return true;
    }
}*/
